<template>
    <el-card shadow="never" :body-style="{ padding: '16px' }">
        <div class="ad_title">{{ title }}</div>
        <div class="tip_info">
            <div class="tip_pic">
                <slot name="chart"></slot>
            </div>
            <div class="tip_detail">
                <div v-for="(item, index) in details" :key="index" class="tip_c">
                    <div class="tip_c_title">{{ item.title }}</div>
                    <div class="tip_c_detail" :style="{ color: item.color }">
                        <span>{{ item.value }}</span>
                        <el-icon>
                            <component v-if="item.icon" :is="item.icon"></component>
                        </el-icon>
                    </div>
                </div>
            </div>
        </div>
    </el-card>
</template>

<script setup name="TipCard">
const props = defineProps({  
    title: {  
        type: String,  
        required: true  
    },  
    details: {  
        type: Array,  
        required: true  
    }  
})
</script>

<style lang="scss" scoped>
.ad_title {
    font-size: 14px;
    font-weight: 600;
    font-family: "Montserrat";
    color: #333333;
    display: flex;
    align-items: center;
    padding-left: 14px;
    position: relative;
    margin-bottom: 16px;

    &:before {
        content: "";
        position: absolute;
        width: 4px;
        height: 12px;
        background: #0783ff;
        left: 0;
        margin: auto;
    }
}

.tip_info {
    display: flex;

    .tip_pic {
        flex: 2;
    }

    .tip_detail {
        flex: 1;
        padding-top: 0px;
        padding-right: 12px;
        padding-left: 20px;
        border-left: 1px solid #ececec;

        .tip_c {
            display: flex;
            align-items: center;
            padding: 6px 0;

            .tip_c_title {
                text-align: left;
                font-weight: 400;
                flex: 2;
                font-size: 13px;
                color: #333333;
            }

            .tip_c_detail {
                flex: 1;
                font-size: 13px;
                font-weight: 600;
                display: flex;
                align-items: flex-start;
                justify-content: flex-end;
            }
        }
    }
}
</style>